import React from 'react';
import { HashRouter, Route, Switch, Redirect } from 'react-router-dom'
import Login from '../views/Login/Login'
import NewsSandBox from '../views/NewsSandBox/NewsSandBox'

const IndexRouter = () => {
    // const token = localStorage.setItem('token')
    return (
        <HashRouter>
            <Switch>
                <Route path="/login" component={Login} />
                {/* <Route path="/" component={NewsSandBox}/> */}
                <Route path='/' render={()=>
                localStorage.getItem('token')?<NewsSandBox />:<Redirect to="/login/"/> 
                }></Route>
                
            </Switch>
        </HashRouter>
    );
};

export default IndexRouter;